package dao;
import java.sql.*;

public class DAOFactory {
	private static final String Driver= "com.mysql.jdbc.Driver";
    private static final String DBURL= "jdbc:mysql://localhost:3306/mydb";
    private static final String dbuser= "root";
    private static final String dbpass= "";
    
    public static  Connection c;

    public static void connect() throws Exception {
        try {
            Class.forName(Driver);
            c = DriverManager.getConnection(DBURL, dbuser, dbpass);
        } catch (Exception e) {
            throw new Exception("Neuspjelo povezivanje sa bazom.");
        }
    }

    public static void disconnect() throws Exception {
        try {
            c.close();
        } catch (Exception e) {
            throw new Exception("Neuspio prekid veze sa bazom.");
        }
    }
    
  public static KorisnikDAO getKorisnikDAO() throws Exception {
 	return new KorisnikDAO(c);
 	
 }
         
}
